package com.mmzsblog.springboot.queue.consummer;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.TextMessage;

/**
 * @author ：mmzsblog.cn
 * @date ：Created in 2021/11/17 17:06
 * @description：
 * @modified By：
 * @version:
 */
//@Component
public class QueueConsummer {

    /**
     * 注解监听
     *
     * @param textMessage
     * @throws Exception
     */
    @JmsListener(destination = "${queue}")
    public void receive(TextMessage textMessage) throws Exception {
        System.out.println("消费者收到一条队列消息：" + textMessage.getText());
    }

}
